//
//  Collect_Cv.swift
//  MikerShop
//
//  Created by eme on 2016/11/22.
//  Copyright © 2016年 eme. All rights reserved.
//

/*
 owner:cy
 update:2016年11月22日11:01:29
 info: 收藏
 */
import RxSwift
import MJRefresh
import AddCarCore
import UtilCore
import EmptyDataView
import RickonCore
import BrandonCore


class Collect_Vc: Empty_TVc,AddCarProtocol {
    
    /****************************Storyboard UI设置区域****************************/
    @IBOutlet weak var goods_TableView: UITableView!                //商品列表
    
    @IBOutlet weak var brand_TableView: UITableView!                //品牌列表
    
    @IBOutlet weak var custom_SrollerView: UIScrollView!            //滑动视图
    
    @IBOutlet weak var redView: UIView!                             //红色移动View
    
    @IBOutlet weak var goods_Button: UIButton!                      //商品按钮
    
    @IBOutlet weak var brand_Button: UIButton!                      //品牌按钮
    
    @IBOutlet weak var scrollViewWithBottom: NSLayoutConstraint!    //滑动视图对于底部距离
    
    @IBOutlet weak var line2View: UIView!
    
    @IBOutlet weak var lineView: UIView!
    
    var isPush = false                                              //是否是Push到界面的(有两个入口)
    
    var isEditor = false                                            //是否编辑(右上角编辑-完成)
    
    var cancelCollectButton:UIButton! = nil                         //取消收藏按钮
    
    var goodsListArr = [CollectGoodsListModel](){                   //数据数组(测试)
        didSet{
            self.goods_TableView.reloadData()
        }
    }
    var brandListArr = [CollectBrandModel](){                       //品牌数组(测试)
        didSet{
            self.brand_TableView.reloadData()
        }
    }
    
    let brandHearder = MJRefreshNormalHeader()                      //品牌顶部刷新
    
    let brandFooter = MJRefreshAutoNormalFooter()                   //品牌底部刷新
    
    
    let goodsHearder = MJRefreshNormalHeader()                      //商品顶部刷新
    
    let goodsFooter = MJRefreshAutoNormalFooter()                   //商品底部刷新
    
    
    private var glvm :GetGoodListVm! = nil                          //获取商品列表Vm
    private var bdvm :GetbrandListVm! = nil                         //获取品牌列表Vm
    
    private var delbrandVm:DelCollectViewModel! = nil               //品牌收藏取消Vm
    
    private var delGoodVm:DelGoodsCollectVm! = nil                  //商品收藏取消Vm
    
    var countArr = [Int](){
        didSet{
            if countArr.contains(1) == true{
                self.cancelCollectButton.isEnabled = true
            }else{
                self.cancelCollectButton.isEnabled = false
            }
        }
    }
    var cdid = ""                                                   //品牌取消时传入的id
    var gdsid = ""                                                  //商品取消时传入的id
    var gdsidArr = [String]()
    var cdidArr = [String]()
    let buttonWithEditor = UIButton(type:.system)                   //编辑按钮
    
    var brandempty:Bool = true                                      //品牌为空
    
    var goodsempty:Bool = true                                      //商品为空
    
    var GetSku:GetSkuVm?                                            //获取商品列表(在这里是获取SKU的)
    
    var isEditor_Variable = Variable<Bool>(true)                    //是否是编辑状态
    
    var isAccording_Variable = Variable<Int>(0)
    
//    var manageVm:ProductDetail_Vm?
    
    var abc = 1
    /*----------------------------   自定义属性区域    ----------------------------*/
    
    //顶部商品按钮与品牌按钮点击
    @IBAction func goodsOrBrandClicked(_ sender: UIButton) {
        
        UIView.beginAnimations(nil, context: nil)
        UIView.setAnimationDuration(0.5)
        UIView.setAnimationCurve(.easeInOut)
        custom_SrollerView.contentOffset.x = CGFloat(sender.tag) * self.view.frame.width
        redView.center.x = sender.center.x
        UIView.commitAnimations()
    }
    
    /****************************Storyboard 绑定方法区域****************************/
    
    @IBAction func add_JHD(_ sender: UIButton) {
        if let _ = AppData.loginedUser{
            if case AppDataState.audited = AppData.appState{
                self.GetSku?.getSKU.onNext("\(goodsListArr[sender.tag].pdid)")
            }else{
                _ = "authvalidation".openURL(["isneedlogin":"1"])
            }
        }else{
            _ = "login".openURL()
        }
        
        
    }
    
    
    /**************************** 以下是方法区域 ****************************/
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        //如果是Push进入的话就显示退出按钮(隐藏navigationBar)
        if isPush != false{
            self.customLeftBarButtonItem()
            self.navigationController?.setNavigationBarHidden(false, animated: true)
            self.tabBarController?.tabBar.isHidden = true
            if let _ = AppData.loginedUser{
                
                self.glvm.getCollectGoodsList.onNext()
                self.bdvm.getBrandList.onNext()
            }
        }else{
            if let _ = AppData.loginedUser{
                
                self.glvm.getCollectGoodsList.onNext()
                self.bdvm.getBrandList.onNext()
                for view in self.view.subviews{
                    if view.isKind(of: AuditInfoView.self){
                        view.removeFromSuperview()
                    }
                }
                
            }else{
                if case AppDataState.tourists = AppData.appState{
                   AuditInfoView.showByView(supView: self.view)
                }
            }
            self.tabBarController?.tabBar.isHidden = false
        }
        self.isEditor_Variable.value = true
        self.isEditor = false
        
        
        
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        if isPush != false{
            self.navigationController?.setNavigationBarHidden(false, animated: true)
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        
    }
    /**
     界面基础设置
     */
    override func setupUI() {
        /**
         *  自定义 导航栏左侧 返回按钮
         */
        // 上拉刷新
        brandHearder.setRefreshingTarget(self, refreshingAction: #selector(Collect_Vc.brandHeaderRefresh))
        self.brand_TableView.mj_header = brandHearder
        
        // 下拉加载更多
        brandFooter.setRefreshingTarget(self, refreshingAction: #selector(Collect_Vc.brandFooterRefresh))
        brandFooter.isAutomaticallyHidden = true
        self.brand_TableView.mj_footer = brandFooter
        
        // 上拉刷新
        goodsHearder.setRefreshingTarget(self, refreshingAction: #selector(Collect_Vc.headerRefresh))
        self.goods_TableView.mj_header = goodsHearder
        
        // 下拉加载更多
        goodsFooter.setRefreshingTarget(self, refreshingAction: #selector(Collect_Vc.footerRefresh))
        goodsFooter.isAutomaticallyHidden = true
        self.goods_TableView.mj_footer = goodsFooter
        
        //添加空数据代理(商品)
        self.goods_TableView.dzn_tv_emptyDataSource = self
        self.goods_TableView.dzn_tv_emptyDelegate = self
        self.goods_TableView.tableFooterView = UIView()
        
        //添加空数据代理(品牌)
        self.brand_TableView.dzn_tv_emptyDelegate = self
        self.brand_TableView.dzn_tv_emptyDataSource = self
        self.brand_TableView.tableFooterView = UIView()
        self.brand_TableView.showsVerticalScrollIndicator = false
        self.goods_TableView.showsVerticalScrollIndicator = false
        
        lineView.backgroundColor = Theme.v.separate_Line
        line2View.backgroundColor = Theme.v.separate_Line
        
        
        self.brand_Button.titleLabel?.normal_fontSize(15)
        self.goods_Button.titleLabel?.normal_fontSize(15)
        
        setUpScrollView()
        setUpTableView()
        setTheEditorButton()
        setCollectButton()
        
    }
    func setUpScrollView(){
        
        custom_SrollerView.delegate = self
    }
    func setUpTableView(){
        
        goods_TableView.delegate = self
        goods_TableView.dataSource = self
        goods_TableView.allowsMultipleSelectionDuringEditing = true
        goods_TableView.allowsMultipleSelection = true
        brand_TableView.delegate = self
        brand_TableView.dataSource = self
        brand_TableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
    }
    func setTheEditorButton(){
        
        buttonWithEditor.frame = CGRect(x:0,y:0,width: 30,height: 15)
        buttonWithEditor.titleLabel?.normal_fontSize(15)
        buttonWithEditor.setTitle("编辑", for: .normal)
        buttonWithEditor.addTarget(self, action: #selector(Collect_Vc.editorBrandOrGoods(_:)), for: .touchUpInside)
        let editorButton = UIBarButtonItem(customView: buttonWithEditor)
        self.navigationItem.rightBarButtonItem = editorButton
    }
    func setCollectButton(){
        
        cancelCollectButton = UIButton(type:.custom)
        cancelCollectButton.isHidden = true
        cancelCollectButton.titleLabel?.font = UIFont.init(name: "Helvetica Neue Medium", size: 15)
        cancelCollectButton.setTitle("取消收藏", for: .normal)
        cancelCollectButton.setBackgroundImage(Theme.sansa.collect.collect_Default_Btn.getImage(), for: .normal)
        cancelCollectButton.setBackgroundImage(Theme.sansa.collect.collect_highlighted_Btn.getImage(), for: .highlighted)
        cancelCollectButton.setBackgroundImage(Theme.sansa.collect.collect_Disable_Btn.getImage(), for: .disabled)
        cancelCollectButton.addTarget(self, action: #selector(Collect_Vc.cancelCollect), for: .touchUpInside)
        self.view.addSubview(cancelCollectButton)
        cancelCollectButton.snp.makeConstraints { (make) in
            make.left.right.equalTo(0)
            if isPush == true{
                make.bottom.equalTo(0)
            }else{
                make.bottom.equalTo(-49)
            }
            make.height.equalTo(49)
        }
    }
    
    //------------------------------
    //编辑-完成按钮点击事件
    func editorBrandOrGoods(_ sender:UIButton){
        
        if isEditor == false {
            
            
            self.isEditor_Variable.value = isEditor
            isEditor = true
            //            self.cancelCollectButton.enabled = true
            
            
        }else{
            
            self.isEditor_Variable.value = isEditor
            isEditor = false
            //            self.cancelCollectButton.enabled = false
        }
        
        
        goods_TableView.reloadData()
        brand_TableView.reloadData()
    }
    //--------------------------------------------------------------------------
    //取消收藏点击事件
    func cancelCollect(){
        
        for model in brandListArr{
            if model.isclicked == 1{
                self.cdidArr.append("\(model.cid)")
                self.cdid = cdidArr.joined(separator: ",")
            }
        }
        
        for model in goodsListArr{
            if model.isclicked == 1{
                self.gdsidArr.append("\(model.cid)")
                self.gdsid = gdsidArr.joined(separator: ",")
            }
        }
        
        if cdid != ""{
            self.delbrandVm.setBrandCollect.onNext(self.cdid)
        }
        if gdsid != ""{
            self.delGoodVm.setGoodsCollect.onNext(self.gdsid)
        }
    }
    
    
    // MARK:下拉上拉
    // 顶部刷新
    // 商品列表刷新
    func headerRefresh(){
        // 结束刷新
        self.goods_TableView.mj_header.endRefreshing()
    }
    
    func footerRefresh(){
        
        self.goods_TableView.mj_footer.endRefreshing()
    }
    // ------------
    // 品牌刷新
    func brandHeaderRefresh(){
        
        self.brand_TableView.mj_header.endRefreshing()
    }
    
    func brandFooterRefresh(){
        
        self.brand_TableView.mj_footer.endRefreshing()
    }
    func emptyBtnClicked(){
        print("点击了")
    }
    
    /**
     绑定到viewmodel 设置
     */
    override func bindToViewModel(){
        
        //---------------------------
        //收藏商品列表
        
        self.glvm = GetGoodListVm(
            input: (
                refreshTriger:  rx.sentMessage(#selector(Collect_Vc.headerRefresh)).map { _ in () },
//                    , rx.sentMessage(#selector(Collect_Vc.viewWillAppear)).map { _ in () })
//                    .merge(),
                loadMoreTriger: rx.sentMessage(#selector(Collect_Vc.footerRefresh)).map { _ in () }
            )
        )
        
        self.glvm.backDate
            .asObservable()
            .do(onNext: {[unowned self] _ in
                
                self.errorPageView.isHidden = true
                
        }).skip(1).subscribe(onNext:{[unowned self] goodsList in
            
            self.showEmptyView = true
            self.goodsListArr = goodsList
            self.isAccording_Variable.value = Int(self.custom_SrollerView.contentOffset.x/UIScreen.main.bounds.width)

            
        }).addDisposableTo(disposeBag)
        
        self.glvm.hasNextPage.asDriver().asObservable().subscribe(onNext:{ [unowned self] hasNextPage in
            if !hasNextPage{
                
                self.goodsFooter.endRefreshingWithNoMoreData()
                
            }else{
                
                self.goodsFooter.resetNoMoreData()
            }
        }).addDisposableTo(disposeBag)
        
        
        self.glvm.loading.bindTo(self.view.rx_loading).addDisposableTo(disposeBag)
        self.glvm.error.bindTo(self.view.rx_error).addDisposableTo(disposeBag)
        self.errorPageView.reloadSubject.bindTo(self.glvm.reloadTrigger).addDisposableTo(disposeBag)
        
        //---------------------------
        //收藏品牌列表
        
        self.bdvm = GetbrandListVm(
            input: (
                refreshTriger:  rx.sentMessage(#selector(Collect_Vc.brandHeaderRefresh)).map { _ in () },
                loadMoreTriger: rx.sentMessage(#selector(Collect_Vc.brandFooterRefresh)).map { _ in () }
            )
        )
        
        self.bdvm.backDate
            .asObservable()
            .do(onNext: {[unowned self] _ in
                
                self.errorPageView.isHidden = true
            })
            .skip(1)
            .subscribe(onNext:{[unowned self] goodsList in
                
                self.showEmptyView = true
                self.brandListArr = goodsList

                self.isAccording_Variable.value = Int(self.custom_SrollerView.contentOffset.x/UIScreen.main.bounds.width)
            
        }).addDisposableTo(disposeBag)
        
        self.bdvm.hasNextPage.asDriver().asObservable().subscribe(onNext:{[unowned self] hasNextPage in
            
            if !hasNextPage{
                self.brandFooter.endRefreshingWithNoMoreData()
                
            }else{
                self.brandFooter.resetNoMoreData()
                
            }
        }).addDisposableTo(disposeBag)
        
        self.bdvm.loading.bindTo(self.view.rx_loading).addDisposableTo(disposeBag)
        self.bdvm.error.bindTo(self.view.rx_error).addDisposableTo(disposeBag)
        self.errorPageView.reloadSubject.bindTo(self.bdvm.reloadTrigger).addDisposableTo(disposeBag)
        //--------------------------------------------
        //----取消收藏品牌VM
        self.delbrandVm = DelCollectViewModel()
        
        self.delbrandVm.backDate.asObservable().skip(1).subscribe(onNext:{ result in
            
            self.brandListArr = result
            self.gdsid = ""
            self.gdsidArr.removeAll()
            if result.count != 0{
                
                for model in self.brandListArr{
                    model.isclicked = 0
                }
            }else{
                self.goods_TableView.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
                self.brandempty = true
            }
            self.isAccording_Variable.value = 1
            
            
            }).addDisposableTo(disposeBag)
        
        self.delbrandVm.error.bindTo(self.view.rx_error).addDisposableTo(disposeBag)
        
        //--------------------------------------------
        //----取消收藏商品VM
        
        self.delGoodVm = DelGoodsCollectVm()
        
        self.delGoodVm.backDate.asObservable().skip(1).subscribe(onNext:{ result in
            
            self.goodsListArr = result
            self.gdsid = ""
            self.gdsidArr.removeAll()
            if result.count != 0{
                for model in self.goodsListArr{
                    model.isclicked = 0
                }
                
            }else{
                
                self.goods_TableView.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
                self.goodsempty = true
                
            }
            self.isAccording_Variable.value = 0
            
            self.cancelCollectButton.isEnabled = false
            self.view.toast("删除成功")
            
            }).addDisposableTo(disposeBag)
        
        self.delGoodVm.error.bindTo(self.view.rx_error).addDisposableTo(disposeBag)
        self.delGoodVm.error.subscribe(onNext:{ error in
            
            self.cancelCollectButton.isEnabled = true
            
            
            }).addDisposableTo(disposeBag)
        
        //======加入铺货单
        self.GetSku = GetSkuVm()
        
//        let manageVm = Add_shoppingCartVm()
        
        self.GetSku?.backSkuDate.asObserver().subscribe(onNext:{ result in
            
            self.addCar(vc: self, model: result,footerButonType:"jrphd"){ product , param,_ in
                self.GetSku?.addcartsSubject.onNext(param["osCarts"] as! String as NSString)
            }
//
        }).addDisposableTo(disposeBag)
        
        self.GetSku?.addcartsSuccess.subscribe(onNext:{ data in
            
            _ = "orderformbadge".openURL()              //添加标记
            
            self.view.toastErrorCode(100041002)
            
            
            }).addDisposableTo(disposeBag)
        
        self.GetSku?.error.bindTo(self.view.rx_error).addDisposableTo(disposeBag)
        
        
        self.custom_SrollerView.rx.contentOffset.subscribe(onNext:{ point in
            
            self.isAccording_Variable.value = Int(point.x/UIScreen.main.bounds.width)
            
            }).addDisposableTo(disposeBag)
        
        self.isAccording_Variable.asObservable().subscribe(onNext:{ index in
            if index == 1{
                
                
                if self.brandListArr.count == 0{
                    
                    self.buttonWithEditor.isHidden = true
                    self.cancelCollectButton.isHidden = true
                    
                }else{
                    self.buttonWithEditor.isHidden = false
                    if self.isEditor == true{
                        self.cancelCollectButton.isHidden = false
                    }else{
                        self.cancelCollectButton.isHidden = true
                    }
                }
            }else{
                if self.goodsListArr.count == 0{
                    
                    self.buttonWithEditor.isHidden = true
                    self.cancelCollectButton.isHidden = true
                    
                }else{
                    
                    self.buttonWithEditor.isHidden = false
                    if self.isEditor == true{
                        self.cancelCollectButton.isHidden = false
                    }else{
                        self.cancelCollectButton.isHidden = true
                    }
                }
            }
        }).addDisposableTo(disposeBag)
        
        
        self.isEditor_Variable.asObservable().subscribe(onNext:{ editorType in
            
            if editorType == false{
                
                self.buttonWithEditor.setTitle("完成", for: .normal)
                
                if self.isPush == true{
                    
                    self.scrollViewWithBottom.constant = 49
                    
                }else{
                    self.scrollViewWithBottom.constant = 49
                }
                self.cancelCollectButton.isHidden = false
                self.cancelCollectButton.isEnabled = false
                
                
            }else{
                
                self.buttonWithEditor.setTitle("编辑", for: .normal)
                if self.isPush == false{
                    self.scrollViewWithBottom.constant = 0
                }else{
                    self.scrollViewWithBottom.constant = 0
                }
                self.cancelCollectButton.isHidden = true
            }
            
            
        }).addDisposableTo(disposeBag)
    }
    
}
extension Collect_Vc:UIScrollViewDelegate{

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        
        if scrollView == self.custom_SrollerView{
            UIView.beginAnimations(nil, context: nil)
            UIView.setAnimationDuration(0.5)
            UIView.setAnimationCurve(.easeOut)
            self.redView.frame.origin.x = (scrollView.contentOffset.x/2) + goods_Button.frame.origin.x
            UIView.commitAnimations()
        }
    }
}
extension Collect_Vc:UITableViewDelegate,UITableViewDataSource{
    func numberOfSections(in tableView: UITableView) -> Int {
        if tableView == goods_TableView{
            if goodsListArr.count != 0{
                return 1
            }else{
                return 0
            }
        }else{
            if brandListArr.count != 0{
                return 1
            }else{
                return 0
            }
        }
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if tableView == goods_TableView{
            return goodsListArr.count
        }else{
            return brandListArr.count
        }
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if tableView == goods_TableView{
            let model = goodsListArr[indexPath.row]
            let cell = tableView.dequeueReusableCell(withIdentifier: "goodsCell") as! GoodsTableViewCell
            cell.gooditem = model
            cell.isEditor = isEditor
            cell.addJHD_Button.tag = indexPath.row
            cell.goodsImageView.setUrlImage(goodsListArr[indexPath.row].img1)
            return cell
        }else{
            let cell = tableView.dequeueReusableCell(withIdentifier: "brandcell") as! BrandTableViewCell
            let model = brandListArr[indexPath.row]
            cell.item = model
            cell.isEditor = isEditor
            return cell
        }
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        if tableView == goods_TableView{
            return 120
        }else{
            return 62.5
        }
    }
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if isEditor == true{
            if tableView == self.goods_TableView{
                
                let model = self.goodsListArr[indexPath.row]
                
                if model.isclicked == 0{
                    
                    model.isclicked = 1
                    
                }else{
                    
                    model.isclicked = 0
                }
                self.goods_TableView.reloadData()
                
            }else{
                
                let brandModel = self.brandListArr[indexPath.row]
                
                if brandModel.isclicked == 0{
                    
                    brandModel.isclicked = 1
                    
                }else{
                    
                    brandModel.isclicked = 0
                }
                
                self.brand_TableView.reloadData()
            }
            var countArr = [Int]()
            for model in self.goodsListArr{
                if model.isclicked == 0{
                    countArr.append(0)
                }else{
                    countArr.append(1)
                }
            }
            for brandModel in self.brandListArr{
                if brandModel.isclicked == 0{
                    countArr.append(0)
                }else{
                    countArr.append(1)
                }
            }
            if countArr.contains(1) == true{
                self.cancelCollectButton.isEnabled = true
            }else{
                self.cancelCollectButton.isEnabled = false
            }
        }else{
            if tableView == goods_TableView{
                let model = self.goodsListArr[indexPath.row]
                _ = "productdetail".openURL(["pdid":"\(model.pdid)"])
            }else{
                _ = "brandpage".openURL(["brid":self.brandListArr[indexPath.row].brid])
            }
        }
        
    }
    
}
extension Collect_Vc{
    
    override func didTap(emptyView scrollView: UIScrollView, button: UIButton) {
        if isPush == true{
            
            self.tabBarController?.tabBar.isHidden = false
        }
        self.tabBarController?.selectedIndex = 0
    }
}
extension Collect_Vc:EmptyDataSource{
    func description(emptyView scrollView: UIScrollView) -> NSAttributedString? {
        if scrollView == brand_TableView{
            brand_TableView.emptyView_Tv?.reload_Btn.layer.cornerRadius = 0
            brand_TableView.emptyView_Tv?.reload_Btn.layer.borderWidth = 1
            brand_TableView.emptyView_Tv?.reload_Btn.layer.borderColor = UIColor(hex:"333333").cgColor
            brand_TableView.emptyView_Tv?.reload_Btn.titleLabel?.normal_fontSize(14)
            return Theme.getEmptyDesc("您还未收藏品牌")
        }else{
            goods_TableView.emptyView_Tv?.reload_Btn.layer.cornerRadius = 0
            goods_TableView.emptyView_Tv?.reload_Btn.layer.borderWidth = 1
            goods_TableView.emptyView_Tv?.reload_Btn.layer.borderColor = UIColor(hex:"333333").cgColor
            goods_TableView.emptyView_Tv?.reload_Btn.titleLabel?.normal_fontSize(14)
            return Theme.getEmptyDesc("你还未收藏商品")
        }
        
    }
    func image(emptyView scrollView: UIScrollView) -> UIImage? {
        if scrollView == brand_TableView{
            return UIImage.init(named: "brandempty", in: SansaCore.bundle, compatibleWith: nil)
        }else{
            return UIImage.init(named: "brandempty", in: SansaCore.bundle, compatibleWith: nil)
        }
        
    }
    func buttonTitle(emptyView scrollView: UIScrollView, state: UIControlState) -> NSAttributedString? {
        return Theme.getEmptyButtonTitle("去首页逛逛")
    }
    
    func backgroundColor(emptyView scrollView: UIScrollView) -> UIColor?{
        return UIColor.white
    }
}

